class Solution(object):
    def pushDominoes(self, dominoes):
        n = len(dominoes)
        d = list(dominoes)
        d_l = [0] * n
        d_r = [0] * n
        state = 0
        time = 0
        for i in range(n):
            if dominoes[i] == 'L':
                state = 0
                time = 0
            else:
                if dominoes[i] == 'R':
                    state = 1
                    time = 0
                else:
                    if state == 1:
                        time += 1
                        d_r[i] = time
        for i in range(n - 1, -1, -1):
            if dominoes[i] == 'L':
                state = 1
                time = 0
            else:
                if dominoes[i] == 'R':
                    state = 0
                    time = 0
                else:
                    if state == 1:
                        time += 1
                        d_l[i] = time
        for i in range(n):
            if dominoes[i] == '.':
                if d_l[i]:
                    if d_r[i]:
                        if d_l[i] == d_r[i]:
                            d[i] = '.'
                        if d_l[i] < d_r[i]:
                            d[i] = 'L'
                        if d_l[i] > d_r[i]:
                            d[i] = 'R'
                    else:
                        d[i] = 'L'
                else:
                    if d_r[i]:
                        d[i] = 'R'
                    else:
                        d[i] = '.'
        return ''.join(d)


data = Solution()
domines = ".L.R...LR..L.."
print(data.pushDominoes(domines))